﻿using System;
using System.Reflection;

namespace Common.DataModels;

/// <summary>
/// 配置的时候 注入依赖需要通过反射
/// 这边配置所有的types
/// </summary>
public class SetupTypesConfig
{
    /// <summary>
    /// autofac自动依赖注入的命名空间下的类
    /// </summary>
    public Assembly[]? AutofacRegisterTypes { get; set; }
    /// <summary>
    /// autofac拦截器的类型
    /// </summary>
    public Type[]? AutofacInterceptTypes { get; }
    /// <summary>
    /// automapper配置文件的类型
    /// </summary>
    public Assembly[]? AutoMapperConfigRegisterAssemblies { get; set; }

    public Assembly? FluentValidationAssembly { get; set; }

    public Assembly? MediatRAssembly { get; set; }

    public Assembly[]? EventBusAssembly { get; set; }
    /// <summary>
    /// 过滤器类型
    /// </summary>
    public Type[] FilterTypes { get; set; }

    public SetupTypesConfig( Assembly[]? autofacRegisterTypes=null, Assembly[]? autoMapperConfigRegisterAssemblies= null, Type[]? autofacInterceptTypes=null, Type[] filterTypes = null, Assembly fluentValidationAssembly=null,Assembly? mediatRAssembly=null, Assembly[]? eventBusAssembly=null)
    {
        FluentValidationAssembly = fluentValidationAssembly;
        FilterTypes = filterTypes;
        AutofacRegisterTypes = autofacRegisterTypes;
        AutofacInterceptTypes = autofacInterceptTypes;
        AutoMapperConfigRegisterAssemblies = autoMapperConfigRegisterAssemblies;
        MediatRAssembly = mediatRAssembly;
        EventBusAssembly = eventBusAssembly;
    }

    public SetupTypesConfig()
    {
        
    }
}